<template>
	<view class="item-container">
		<view class="item-header">
			<image :src="info.author.avatar" mode="aspectFill"></image>
			<text class="author-name">{{ info.author.name }}</text>
			<text class="article-category">{{ info.category }}</text>
		</view>
		<view class="item-title">{{ info.title }}</view>
		<view class="item-summary">{{ info.summary }}</view>
		<view class="item-bottom">
			<view class="item-like-count"><text class="iconfont icon-like"></text>{{ info.like_count }}</view>
			<view class="item-comment-count"><text class="iconfont icon-comment"></text>{{info.comment_count}}</view>
		</view>
	</view>
</template>

<script>
	export default {
		name: "ArticleItem",
		props: {
			info: {
				type: Object,
				required: true
			}
		},
		data() {
			return {

			};
		}
	}
</script>

<style>
	.item-container {
		display: flex;
		flex-direction: column;
		background-color: #fff;
		padding: 20rpx;
		margin: 10rpx 0;
	}

	.item-header {
		display: flex;
		align-items: center;
		margin-bottom: 6rpx;
	}

	.item-header image {
		width: 60rpx;
		height: 60rpx;
		border-radius: 50%;
		margin-right: 20rpx;
	}

	.author-name {
		font-size: 24rpx;
	}

	.article-category {
		flex: 1;
		text-align: right;
		font-size: 24rpx;
		color: #8891ab;
	}

	.item-title {
		font-size: 28rpx;
		font-weight: 600;
		line-height: 40px;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 2;
		overflow: hidden;
		text-overflow: ellipsis;
	}

	.item-summary {
		display: -webkit-box;
		-webkit-box-orient: vertical;
		-webkit-line-clamp: 3;
		overflow: hidden;
		text-overflow: ellipsis;
		font-size: 24rpx;
		line-height: 36rpx;
		margin-bottom: 10rpx;
	}

	.item-bottom {
		display: flex;
		font-size: 20rpx;
		color: #8891ab;
	}

	.item-like-count {
		margin-right: 40rpx;
	}

	.item-bottom .iconfont {
		margin-right: 4rpx;
	}
</style>
